Ext.ns('net.autodata.compare.data');
(function () {
	
	var Proxy = Ext.extend(Ext.data.DataProxy, {
		
		constructor: function ()
		{
			var api = {};
			api[Ext.data.Api.actions.read] = true;
			Proxy.superclass.constructor.call(this, {api: api});
		},
		
		doRequest: function (action, rs, params, reader, callback, scope, arg)
		{
			// No implementation for CRUD in MemoryProxy.  Assumes all actions are 'load'
			
			//Grab the exterior colours from the base vehicle stored in session
			
			var session = net.autodata.Session.getInstance();
			var colours = session.vehicles.getBaseVehicle().exteriorColours.getRange();
						
			try {
				result = reader.readRecords({ rows: colours });
			} catch (e) {
				// @deprecated loadexception
				this.fireEvent("loadexception", this, null, arg, e);
	
				this.fireEvent('exception', this, 'response', action, arg, null, e);
				callback.call(scope, null, arg, false);
				return;
			}
			callback.call(scope, result, arg, true);
		}		
	});
	
	net.autodata.compare.data.ColourPickerSessionProxy = Proxy;
	
})();